/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package klasy;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Cyga
 */
@Entity
@Table(name = "choroba", catalog = "pai1", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Choroba.findAll", query = "SELECT c FROM Choroba c"),
    @NamedQuery(name = "Choroba.findByIdChoroba", query = "SELECT c FROM Choroba c WHERE c.idChoroba = :idChoroba"),
    @NamedQuery(name = "Choroba.findByNazwa", query = "SELECT c FROM Choroba c WHERE c.nazwa = :nazwa"),
    @NamedQuery(name = "Choroba.findByOpis", query = "SELECT c FROM Choroba c WHERE c.opis = :opis"),
    @NamedQuery(name = "Choroba.findByZakonczona", query = "SELECT c FROM Choroba c WHERE c.zakonczona = :zakonczona"),
    @NamedQuery(name = "Choroba.findByDataPocz", query = "SELECT c FROM Choroba c WHERE c.dataPocz = :dataPocz"),
    @NamedQuery(name = "Choroba.findByDataKoniec", query = "SELECT c FROM Choroba c WHERE c.dataKoniec = :dataKoniec")})
public class Choroba implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_choroba")
    private Integer idChoroba;
    @Column(name = "nazwa")
    private String nazwa;
    @Column(name = "opis")
    private String opis;
    @Column(name = "zakonczona")
    private Integer zakonczona;
    @Column(name = "data_pocz")
    @Temporal(TemporalType.DATE)
    private Date dataPocz;
    @Column(name = "data_koniec")
    @Temporal(TemporalType.DATE)
    private Date dataKoniec;
    @JoinColumn(name = "id_pacjent", referencedColumnName = "id_pacjent")
    @ManyToOne(fetch = FetchType.EAGER)
    private Pacjent idPacjent;
    @JoinColumn(name = "id_lekarz", referencedColumnName = "id_lekarz")
    @ManyToOne(fetch = FetchType.EAGER)
    private Lekarz idLekarz;

    public Choroba() {
    }

    public Choroba(Integer idChoroba) {
        this.idChoroba = idChoroba;
    }

    public Integer getIdChoroba() {
        return idChoroba;
    }

    public void setIdChoroba(Integer idChoroba) {
        this.idChoroba = idChoroba;
    }

    public String getNazwa() {
        return nazwa;
    }

    public void setNazwa(String nazwa) {
        this.nazwa = nazwa;
    }

    public String getOpis() {
        return opis;
    }

    public void setOpis(String opis) {
        this.opis = opis;
    }

    public Integer getZakonczona() {
        return zakonczona;
    }

    public void setZakonczona(Integer zakonczona) {
        this.zakonczona = zakonczona;
    }

    public Date getDataPocz() {
        return dataPocz;
    }

    public void setDataPocz(Date dataPocz) {
        this.dataPocz = dataPocz;
    }

    public Date getDataKoniec() {
        return dataKoniec;
    }

    public void setDataKoniec(Date dataKoniec) {
        this.dataKoniec = dataKoniec;
    }

    public Pacjent getIdPacjent() {
        return idPacjent;
    }

    public void setIdPacjent(Pacjent idPacjent) {
        this.idPacjent = idPacjent;
    }

    public Lekarz getIdLekarz() {
        return idLekarz;
    }

    public void setIdLekarz(Lekarz idLekarz) {
        this.idLekarz = idLekarz;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idChoroba != null ? idChoroba.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Choroba)) {
            return false;
        }
        Choroba other = (Choroba) object;
        if ((this.idChoroba == null && other.idChoroba != null) || (this.idChoroba != null && !this.idChoroba.equals(other.idChoroba))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "klasy.Choroba[ idChoroba=" + idChoroba + " ]";
    }
    
}
